#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

vector<int> get_divisors(int n)
{
    vector<int> ret;

    for (int i = 1; i <= n / i; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i != n / i)
            {
                ret.push_back(n / i);
            }
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main()
{
    int n;
    scanf("%d", &n);
    while (n--)
    {
        int m;
        scanf("%d", &m);
        auto v = get_divisors(m);
        for (auto e : v)
        {
            printf("%d ", e);
        }
        printf("\n");
    }
    return 0;
}